package com;

import com.model.AcmeProperties4;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 软注入的第二种方式：构造函数方式
 * 如果不加@EnableConfigurationProperties(AcmeProperties4.class)会启动报错
 */
@RestController
@EnableConfigurationProperties(AcmeProperties4.class)
public class EnabelAcme4ConstructController {

    private AcmeProperties4 acmeProperties4;

    public EnabelAcme4ConstructController(AcmeProperties4 acmeProperties4) {
        this.acmeProperties4 = acmeProperties4;
    }

    @RequestMapping("acme4")
    public String acme4() {
        return this.acmeProperties4.toString();
    }
}
